/*
 * 全时云商务服务股份有限公司.
 * Copyright © 2021 京icp备08005473号. All rights reserved.
 * @Date: 2021-09-03.
 * @Author：
 * @Description 小课堂 - 课程回放
 **/
import React, { memo, useEffect } from "react"
import Taro from '@tarojs/taro'
import { View, Video } from '@tarojs/components'
import './index.scss'

interface Props {
  detailUrl: string // 详情页地址
  id?: string // 设置项的 key值
  label?: string // label
}
/**
 *@Description
 *@Return  课程 - 回放.
 **/
 const VideoPlay: React.FC<Props> = props => {
   console.log("props--CourseDetail----------", props)

   Taro.setBackgroundColor({
    backgroundColor: '#000', // 窗口的背景色为白色
  })
  
  Taro.setBackgroundColor({
    backgroundColorTop: '#000', // 顶部窗口的背景色为白色
    backgroundColorBottom: '#000', // 底部窗口的背景色为白色
  })

   const posterUrl = "https://misc.aotu.io/booxood/mobile-video/cover_900x500.jpg"
   const videoUrl = "https://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"


   useEffect(() => {
    Taro.createVideoContext("video")
   }, [])

   return (
    <View className='cou-video'>
      {/* initialTime: 指定视频初始播放位置 */}

      <Video id='videoPlay' controls autoplay loop={false} muted={false} initialTime={0} src={videoUrl} poster={posterUrl} />

    </View>
   )
 }

export default memo(VideoPlay)

